package com.aj.jobs;

import com.aj.common.RedisConstant;
import com.aj.utils.QiniuUtils;
import org.springframework.beans.factory.annotation.Autowired;
import redis.clients.jedis.JedisPool;

import java.util.Set;

public class ClearImgJob {

    @Autowired
    private JedisPool jedisPool;

    public  void clearImg() {
        //获取两个ste集合差值
        Set<String> sdiff = jedisPool.getResource().sdiff(RedisConstant.SETMEAL_PIC_RESOURCES,RedisConstant.SETMEAL_PIC_DB_RESOURCES);
        for (String pic : sdiff) {
            //遍历删除云的图片
//            QiniuUtils.deleteFileFromQiniu(pic);
            //删除jedis的图片
            jedisPool.getResource().srem(RedisConstant.SETMEAL_PIC_RESOURCES,pic);
        }




    }
}
